import { defineStore } from 'pinia';

export const useUserInformationStore = defineStore('userInformation', {
  state: () => ({
    canUserInformation: {
      exp: null as number | null,
      id: null as number | null,
      role: '',
      username: ''
    }
  }),
  actions: {
    setUserInfo(userInfo: { exp: number; id: number; role: string; username: string }) {
      this.canUserInformation = { ...userInfo };
    },
    clearUserInfo() {
      this.canUserInformation = {
        exp: null,
        id: null,
        role: '',
        username: ''
      };
    },
    getUserInfo() {
      return this.canUserInformation;
    }
  }
});